.class public Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;
.super Landroid/app/Service;
.source "DownloadService.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$UpdateThread;,
        Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$DownloadManagerContentObserver;
    }
.end annotation


# instance fields
.field private mDownloads:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/Long;",
            "Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;",
            ">;"
        }
    .end annotation
.end field

.field private mNotifier:Lcom/zuimeia/sdk/download/providers/downloads/DownloadNotification;

.field private mObserver:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$DownloadManagerContentObserver;

.field private mPendingUpdate:Z

.field mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

.field mUpdateThread:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$UpdateThread;


# direct methods
.method public constructor <init>()V
    .registers 2

    .prologue
    .line 47
    invoke-direct {p0}, Landroid/app/Service;-><init>()V

    .line 65
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mDownloads:Ljava/util/Map;

    .line 170
    return-void
.end method

.method static synthetic access$000(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)V
    .registers 1
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;

    .prologue
    .line 47
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->updateFromProvider()V

    return-void
.end method

.method static synthetic access$100(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)V
    .registers 1
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;

    .prologue
    .line 47
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->trimDatabase()V

    return-void
.end method

.method static synthetic access$200(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)V
    .registers 1
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;

    .prologue
    .line 47
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->removeSpuriousFiles()V

    return-void
.end method

.method static synthetic access$300(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)Z
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;

    .prologue
    .line 47
    iget-boolean v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mPendingUpdate:Z

    return v0
.end method

.method static synthetic access$302(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;Z)Z
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;
    .param p1, "x1"    # Z

    .prologue
    .line 47
    iput-boolean p1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mPendingUpdate:Z

    return p1
.end method

.method static synthetic access$400(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)Ljava/util/Map;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;

    .prologue
    .line 47
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mDownloads:Ljava/util/Map;

    return-object v0
.end method

.method static synthetic access$500(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;J)V
    .registers 6
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;
    .param p1, "x1"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;
    .param p2, "x2"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;
    .param p3, "x3"    # J

    .prologue
    .line 47
    invoke-direct {p0, p1, p2, p3, p4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->updateDownload(Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;J)V

    return-void
.end method

.method static synthetic access$600(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;J)Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;
    .registers 6
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;
    .param p1, "x1"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;
    .param p2, "x2"    # J

    .prologue
    .line 47
    invoke-direct {p0, p1, p2, p3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->insertDownload(Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;J)Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$700(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;J)V
    .registers 4
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;
    .param p1, "x1"    # J

    .prologue
    .line 47
    invoke-direct {p0, p1, p2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->deleteDownload(J)V

    return-void
.end method

.method static synthetic access$800(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)Lcom/zuimeia/sdk/download/providers/downloads/DownloadNotification;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;

    .prologue
    .line 47
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mNotifier:Lcom/zuimeia/sdk/download/providers/downloads/DownloadNotification;

    return-object v0
.end method

.method private deleteDownload(J)V
    .registers 8
    .param p1, "id"    # J

    .prologue
    .line 412
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mDownloads:Ljava/util/Map;

    invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-interface {v1, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    .line 413
    .local v0, "info":Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;
    iget v1, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mStatus:I

    const/16 v2, 0xc0

    if-ne v1, v2, :cond_16

    .line 414
    const/16 v1, 0x1ea

    iput v1, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mStatus:I

    .line 416
    :cond_16
    iget v1, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mDestination:I

    if-eqz v1, :cond_28

    iget-object v1, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mFileName:Ljava/lang/String;

    if-eqz v1, :cond_28

    .line 418
    new-instance v1, Ljava/io/File;

    iget-object v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mFileName:Ljava/lang/String;

    invoke-direct {v1, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/io/File;->delete()Z

    .line 420
    :cond_28
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    iget-wide v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-interface {v1, v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;->cancelNotification(J)V

    .line 421
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mDownloads:Ljava/util/Map;

    iget-wide v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-interface {v1, v2}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    .line 422
    return-void
.end method

.method private insertDownload(Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;J)Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;
    .registers 8
    .param p1, "reader"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;
    .param p2, "now"    # J

    .prologue
    .line 375
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    invoke-virtual {p1, p0, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;->newDownloadInfo(Landroid/content/Context;Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;)Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    move-result-object v0

    .line 376
    .local v0, "info":Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mDownloads:Ljava/util/Map;

    iget-wide v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-interface {v1, v2, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 382
    invoke-virtual {v0, p2, p3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->startIfReady(J)V

    .line 383
    return-object v0
.end method

.method private removeSpuriousFiles()V
    .registers 14

    .prologue
    const/4 v12, 0x0

    const/4 v3, 0x0

    .line 299
    invoke-static {}, Landroid/os/Environment;->getDownloadCacheDirectory()Ljava/io/File;

    move-result-object v0

    invoke-virtual {v0}, Ljava/io/File;->listFiles()[Ljava/io/File;

    move-result-object v9

    .line 300
    .local v9, "files":[Ljava/io/File;
    if-nez v9, :cond_d

    .line 336
    :cond_c
    return-void

    .line 305
    :cond_d
    new-instance v7, Ljava/util/HashSet;

    invoke-direct {v7}, Ljava/util/HashSet;-><init>()V

    .line 306
    .local v7, "fileSet":Ljava/util/HashSet;, "Ljava/util/HashSet<Ljava/lang/String;>;"
    const/4 v10, 0x0

    .local v10, "i":I
    :goto_13
    array-length v0, v9

    if-ge v10, v0, :cond_3f

    .line 307
    aget-object v0, v9, v10

    invoke-virtual {v0}, Ljava/io/File;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "lost+found"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_27

    .line 306
    :cond_24
    :goto_24
    add-int/lit8 v10, v10, 0x1

    goto :goto_13

    .line 310
    :cond_27
    aget-object v0, v9, v10

    invoke-virtual {v0}, Ljava/io/File;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "recovery"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_24

    .line 314
    aget-object v0, v9, v10

    invoke-virtual {v0}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v7, v0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    goto :goto_24

    .line 317
    :cond_3f
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 318
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->getAllDownloadsContentURI(Landroid/content/Context;)Landroid/net/Uri;

    move-result-object v1

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/String;

    const-string v4, "_data"

    aput-object v4, v2, v12

    move-object v4, v3

    move-object v5, v3

    .line 317
    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 320
    .local v6, "cursor":Landroid/database/Cursor;
    if-eqz v6, :cond_70

    .line 321
    invoke-interface {v6}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v0

    if-eqz v0, :cond_6d

    .line 323
    :cond_60
    invoke-interface {v6, v12}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v7, v0}, Ljava/util/HashSet;->remove(Ljava/lang/Object;)Z

    .line 324
    invoke-interface {v6}, Landroid/database/Cursor;->moveToNext()Z

    move-result v0

    if-nez v0, :cond_60

    .line 326
    :cond_6d
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 328
    :cond_70
    invoke-virtual {v7}, Ljava/util/HashSet;->iterator()Ljava/util/Iterator;

    move-result-object v11

    .line 329
    .local v11, "iterator":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/lang/String;>;"
    :goto_74
    invoke-interface {v11}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_c

    .line 330
    invoke-interface {v11}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Ljava/lang/String;

    .line 334
    .local v8, "filename":Ljava/lang/String;
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, v8}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    goto :goto_74
.end method

.method private trimDatabase()V
    .registers 11

    .prologue
    const/4 v4, 0x0

    .line 342
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 343
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->getAllDownloadsContentURI(Landroid/content/Context;)Landroid/net/Uri;

    move-result-object v1

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/String;

    const/4 v3, 0x0

    const-string v5, "_id"

    aput-object v5, v2, v3

    const-string v3, "status >= \'200\'"

    const-string v5, "lastmod"

    .line 342
    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v7

    .line 347
    .local v7, "cursor":Landroid/database/Cursor;
    if-nez v7, :cond_27

    .line 350
    const-string v0, "DownloadManager"

    const-string v1, "null cursor in trimDatabase"

    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 368
    :goto_26
    return-void

    .line 353
    :cond_27
    invoke-interface {v7}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v0

    if-eqz v0, :cond_58

    .line 354
    invoke-interface {v7}, Landroid/database/Cursor;->getCount()I

    move-result v0

    add-int/lit16 v9, v0, -0x3e8

    .line 355
    .local v9, "numDelete":I
    const-string v0, "_id"

    invoke-interface {v7, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v6

    .line 356
    .local v6, "columnId":I
    :goto_39
    if-lez v9, :cond_58

    .line 358
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->getAllDownloadsContentURI(Landroid/content/Context;)Landroid/net/Uri;

    move-result-object v0

    .line 359
    invoke-interface {v7, v6}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v2

    .line 357
    invoke-static {v0, v2, v3}, Landroid/content/ContentUris;->withAppendedId(Landroid/net/Uri;J)Landroid/net/Uri;

    move-result-object v8

    .line 360
    .local v8, "downloadUri":Landroid/net/Uri;
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    invoke-virtual {v0, v8, v4, v4}, Landroid/content/ContentResolver;->delete(Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)I

    .line 361
    invoke-interface {v7}, Landroid/database/Cursor;->moveToNext()Z

    move-result v0

    if-nez v0, :cond_5c

    .line 367
    .end local v6    # "columnId":I
    .end local v8    # "downloadUri":Landroid/net/Uri;
    .end local v9    # "numDelete":I
    :cond_58
    invoke-interface {v7}, Landroid/database/Cursor;->close()V

    goto :goto_26

    .line 364
    .restart local v6    # "columnId":I
    .restart local v8    # "downloadUri":Landroid/net/Uri;
    .restart local v9    # "numDelete":I
    :cond_5c
    add-int/lit8 v9, v9, -0x1

    .line 365
    goto :goto_39
.end method

.method private updateDownload(Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;J)V
    .registers 14
    .param p1, "reader"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;
    .param p2, "info"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;
    .param p3, "now"    # J

    .prologue
    const/4 v5, 0x0

    const/4 v4, 0x1

    .line 391
    iget v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mVisibility:I

    .line 392
    .local v3, "oldVisibility":I
    iget v2, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mStatus:I

    .line 394
    .local v2, "oldStatus":I
    invoke-virtual {p1, p2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo$Reader;->updateFromDatabase(Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;)V

    .line 396
    if-ne v3, v4, :cond_36

    iget v6, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mVisibility:I

    if-eq v6, v4, :cond_36

    iget v6, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mStatus:I

    .line 398
    invoke-static {v6}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->isStatusCompleted(I)Z

    move-result v6

    if-eqz v6, :cond_36

    move v1, v4

    .line 399
    .local v1, "lostVisibility":Z
    :goto_18
    invoke-static {v2}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->isStatusCompleted(I)Z

    move-result v6

    if-nez v6, :cond_38

    iget v6, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mStatus:I

    .line 400
    invoke-static {v6}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->isStatusCompleted(I)Z

    move-result v6

    if-eqz v6, :cond_38

    move v0, v4

    .line 401
    .local v0, "justCompleted":Z
    :goto_27
    if-nez v1, :cond_2b

    if-eqz v0, :cond_32

    .line 402
    :cond_2b
    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    iget-wide v6, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-interface {v4, v6, v7}, Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;->cancelNotification(J)V

    .line 405
    :cond_32
    invoke-virtual {p2, p3, p4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->startIfReady(J)V

    .line 406
    return-void

    .end local v0    # "justCompleted":Z
    .end local v1    # "lostVisibility":Z
    :cond_36
    move v1, v5

    .line 398
    goto :goto_18

    .restart local v1    # "lostVisibility":Z
    :cond_38
    move v0, v5

    .line 400
    goto :goto_27
.end method

.method private updateFromProvider()V
    .registers 3

    .prologue
    .line 160
    const-string v0, "update From Provider"

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/zuimeia/sdk/download/utils/LogTimber;->d(Ljava/lang/String;[Ljava/lang/Object;)V

    .line 161
    monitor-enter p0

    .line 162
    const/4 v0, 0x1

    :try_start_a
    iput-boolean v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mPendingUpdate:Z

    .line 163
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mUpdateThread:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$UpdateThread;

    if-nez v0, :cond_1e

    .line 164
    new-instance v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$UpdateThread;

    invoke-direct {v0, p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$UpdateThread;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)V

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mUpdateThread:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$UpdateThread;

    .line 165
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mUpdateThread:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$UpdateThread;

    invoke-interface {v0, v1}, Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;->startThread(Ljava/lang/Thread;)V

    .line 167
    :cond_1e
    monitor-exit p0

    .line 168
    return-void

    .line 167
    :catchall_20
    move-exception v0

    monitor-exit p0
    :try_end_22
    .catchall {:try_start_a .. :try_end_22} :catchall_20

    throw v0
.end method


# virtual methods
.method public onBind(Landroid/content/Intent;)Landroid/os/IBinder;
    .registers 4
    .param p1, "i"    # Landroid/content/Intent;

    .prologue
    .line 110
    new-instance v0, Ljava/lang/UnsupportedOperationException;

    const-string v1, "Cannot bind to Download Manager Service"

    invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public onCreate()V
    .registers 5

    .prologue
    .line 118
    invoke-super {p0}, Landroid/app/Service;->onCreate()V

    .line 119
    const-string v0, "Service onCreate"

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/zuimeia/sdk/download/utils/LogTimber;->w(Ljava/lang/String;[Ljava/lang/Object;)V

    .line 121
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    if-nez v0, :cond_16

    .line 122
    new-instance v0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;

    invoke-direct {v0, p0}, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    .line 125
    :cond_16
    new-instance v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$DownloadManagerContentObserver;

    invoke-direct {v0, p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$DownloadManagerContentObserver;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;)V

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mObserver:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$DownloadManagerContentObserver;

    .line 126
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 127
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->getAllDownloadsContentURI(Landroid/content/Context;)Landroid/net/Uri;

    move-result-object v1

    const/4 v2, 0x1

    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mObserver:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$DownloadManagerContentObserver;

    .line 126
    invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

    .line 129
    new-instance v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadNotification;

    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    invoke-direct {v0, p0, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadNotification;-><init>(Landroid/content/Context;Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;)V

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mNotifier:Lcom/zuimeia/sdk/download/providers/downloads/DownloadNotification;

    .line 130
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    invoke-interface {v0}, Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;->cancelAllNotifications()V

    .line 132
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->updateFromProvider()V

    .line 133
    return-void
.end method

.method public onDestroy()V
    .registers 3

    .prologue
    .line 149
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->mObserver:Lcom/zuimeia/sdk/download/providers/downloads/DownloadService$DownloadManagerContentObserver;

    invoke-virtual {v0, v1}, Landroid/content/ContentResolver;->unregisterContentObserver(Landroid/database/ContentObserver;)V

    .line 153
    invoke-super {p0}, Landroid/app/Service;->onDestroy()V

    .line 154
    return-void
.end method

.method public onStartCommand(Landroid/content/Intent;II)I
    .registers 5
    .param p1, "intent"    # Landroid/content/Intent;
    .param p2, "flags"    # I
    .param p3, "startId"    # I

    .prologue
    .line 137
    invoke-super {p0, p1, p2, p3}, Landroid/app/Service;->onStartCommand(Landroid/content/Intent;II)I

    move-result v0

    .line 141
    .local v0, "returnValue":I
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadService;->updateFromProvider()V

    .line 142
    return v0
.end method
